<admintpl file="header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>团队管理</a></li>
        <li><a href="{:U('Bdrunpeople/company_add')}">团队添加</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Bdrunpeople/company_list')}">
        <div class="controls">
            <label class="control-label">城市:</label>
            <select onchange="CityChanged();" id="city"  name="formget[city]">
                <option value="">==请选择省==</option>
                <volist name="province_data" id="vo">
                    <if condition="$formget['city'] == $vo['id']" >
                        <option value="{$vo.id}" selected>{$vo.name}</option>
                        <else/>
                        <option value="{$vo.id}" >{$vo.name}</option>
                    </if>
                </volist>
            </select>
            <php>if(count($citys)>0){ </php>

                    <select name="formget[city_id]" id="vcity_id">
                        <option value="">==请选择市==</option>
                        <volist name="citys" id="vo">
                            <if condition="$formget['city_id'] == $vo['city_id']" >
                                <option value="{$vo.city_id}" selected>{$vo.city_name}</option>
                                <else/>
                                <option value="{$vo.city_id}" >{$vo.city_name}</option>
                            </if>
                        </volist>
                        </select>
                    <php>}else{</php>
                    <select name="formget[city_id]" id="city_id">
                    </select>



            <php>}</php>
            <input type="submit" class="btn btn-primary" value="搜索" />
        </div>
    </form>
    <form method="post" class="js-ajax-form">
        <!--<div class="table-actions">-->
            <!--<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Bdrunpeople/sign',array('sign'=>1))}" data-subcheck="true">签约</button>-->
            <!--<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Bdrunpeople/cancelsign',array('unsign'=>1))}" data-subcheck="true">取消签约</button>-->
            <!--<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Bdrunpeople/incubator',array('incubator'=>1))}" data-subcheck="true">领取保温箱</button>-->
            <!--<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Bdrunpeople/freezee',array('freezee'=>1))}" data-subcheck="true" data-msg="您确定冻结账户吗？">冻结</button>-->
            <!--<button class="btn btn-primary btn-small js-ajax-submit" type="submit" data-action="{:U('Bdrunpeople/cancelfreezee',array('cancelfreezee'=>1))}" data-subcheck="true" data-msg="您确定启用账户吗？">启用</button>-->
        <!--</div>-->
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
                <th align="center">序号</th>
                <th>所在省</th>
                <th>所在市</th>
                <th>团队名称</th>
                <th>状态</th>
                <th align="center">{:L('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <php>$status = array('0'=>'非第一位显示','1'=>'第一位显示');</php>
            <foreach name="datas" item="vo" key="k">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.dispatch_id}" title="ID:{$vo.dispatch_id}"></td>
                    <td align="center">{$k+1}</td>
                    <td>{$vo['province_id']|getProvinceName}</td>
                    <td>{$vo['city_id']|getCityName}</td>
                    <td>{$vo['company_name']}</td>
                    <td>{$status[$vo['status']]}</td>
                    <td align="center">
                        <a href="{:U('bdrunpeople/company_edit',array('company_id'=>empty($vo['company_id'])?'':$vo['company_id'],'formget'=>$formget))}">修改</a> |
                        <a href="{:U('bdrunpeople/company_del',array('company_id'=>empty($vo['company_id'])?'':$vo['company_id'],'formget'=>$formget))}" class="js-ajax-delete">{:L('DELETE')}</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <if condition="empty($datas)">
            <div style="padding: 30px;text-align: center;color: #999999">
                <i class="fa fa-database" style="font-size: 38px"></i><br />
                暂无数据
            </div>
        </if>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    function CityChanged(province_id){

        $.ajax({
            url:"{:U('Operation/location_api')}",
            data:"province_id="+$("#city").val(),
            dataType:"JSON",
            success:function(ret){

                cmbAddOption(ret.retValue);
            }
        });
    }

    function cmbAddOption(ret)
    {
        $("#city_id").empty();
        var opetion = '<option value="">==请选择市==</option>';
        for(var i =0; i<ret.length;i++){
            opetion+= '<option value="'+ret[i].id+'">'+ret[i].city+'</option>';
        }
        $("#city_id").append(opetion);
    }
</script>
</body>
</html>